package chapter1.thread.account_Lock;

//存钱的
public class Depositer extends Thread {
    private final Account ac;

    public Depositer(String n, Account ac) {
        super(n);
        this.ac = ac;
    }

    @Override
    public void run() {
        while (true) {
            System.out.println(getName() + "存钱了");
            ac.deposit(200);
            try {
//                synchronized (ac) {
//                    ac.notifyAll(); //上锁（通知解锁，停止wait）
//                }
                MoneyTaker.notice();
                Thread.sleep(6000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
